package com.nobug.shudu;

import java.util.List;

/**
 * @author 389561407@qq.com
 * @version 1.0
 * @since 2022-12-27
 */
public class ShuduUtil {

    private static Matrix matrix;




    /**
     * 输入一个数组，返回一个结果
     * @param matrix
     * @return
     */
    public static Matrix getRes(Matrix matrix) {
        Sudoku sudoku = new Sudoku();
        //获取答案
        List<Matrix> solve = null;
        try{
            solve = sudoku.solve(matrix);
            if(solve.size() > 1){
                System.out.println("请重新校准，有两个结果，初始化数据有错误");
                return matrix;
            }
        }catch (Exception e){
            System.out.println("无解，重新校准初始化");
        }
        return solve.get(0);
    }

    public static Matrix getMatrix() {
        return new Matrix(9,9);
    }
}
